<div class="content-wrapper">
    <?php
    $form = $this->form;
    $form->prepare();

    ?>
    <?php echo $this->form()->openTag($form); ?>
    <section class="content-header">
        <?php echo $this->partial('layout/breadcrumb'); ?>

        <h1 class="pull-right" id="dbshop-menu-top">
            <button type="submit" class="btn btn-primary btn-sm"><i class="fa fa-check"></i> <?php echo $this->translate('保存设置'); ?></button>
            <?php echo $this->HelpUrl('uploadSet'); ?>
        </h1>
    </section>

    <section class="content">

        <div class="row">
            <div class="col-md-12">
                <div class="nav-tabs-custom">
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="#tab_1" data-toggle="tab"><?php echo $this->translate('基本设置'); ?></a></li>
                        <li><a href="#tab_2" data-toggle="tab"><?php echo $this->translate('默认图片'); ?></a></li>
                        <li><a href="#tab_3" data-toggle="tab"><?php echo $this->translate('水印设置'); ?></a></li>
                        <!--li><a href="#tab_4" data-toggle="tab"><?php echo $this->translate('存储方式'); ?></a></li-->
                    </ul>
                    <div class="tab-content">
                        <?php echo $this->partial('layout/messages'); ?>
                        <div class="tab-pane active" id="tab_1">
                            <div class="box-body">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('图片附件最大尺寸'); ?><span class="must_add_value">*</span></label>
                                    <div class="col-sm-2">
                                        <div class="input-group">
                                            <?php echo $this->formElement($form->get('upload_image_max')); ?>
                                            <span class="input-group-addon"><?php echo $this->translate('KB'); ?></span>
                                        </div>
                                        <?php echo $this->formElementErrors($form->get('upload_image_max'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('图片附件允许上传类型'); ?></label>
                                    <div class="col-sm-6">
                                        <?php echo $this->formElement($form->get('image_type')); ?>
                                        <?php echo $this->formElementErrors($form->get('image_type'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="tab-pane" id="tab_2">
                            <div class="box-body">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('商品图片'); ?></label>
                                    <div class="col-sm-2">

                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('缩微图宽度'); ?></label>
                                    <div class="col-sm-2">
                                        <div class="input-group">
                                            <?php echo $this->formElement($form->get('goods_thumb_width')); ?>
                                            <span class="input-group-addon"><?php echo $this->translate('px'); ?></span>
                                        </div>
                                        <?php echo $this->formElementErrors($form->get('goods_thumb_width'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('缩微图高度'); ?></label>
                                    <div class="col-sm-2">
                                        <div class="input-group">
                                            <?php echo $this->formElement($form->get('goods_thumb_height')); ?>
                                            <span class="input-group-addon"><?php echo $this->translate('px'); ?></span>
                                        </div>
                                        <?php echo $this->formElementErrors($form->get('goods_thumb_height'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('缩微图裁切方式'); ?></label>
                                    <div class="col-sm-2">
                                        <?php echo $this->formElement($form->get('goods_image_crop')); ?>
                                        <?php echo $this->formElementErrors($form->get('goods_image_crop'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('图片添加水印'); ?></label>
                                    <div class="col-sm-6">
                                        <div class="checkbox">
                                            <label>
                                                <?php echo $this->formElement($form->get('goods_watermark_state')); ?> <?php echo $this->translate('启用'); ?>
                                                <?php echo $this->formElementErrors($form->get('goods_watermark_state'), ['class'=>'error-message']); ?>
                                            </label>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('图片命名方式'); ?></label>
                                    <div class="col-sm-2">
                                        <?php echo $this->formElement($form->get('goods_image_name_type')); ?>
                                        <?php echo $this->formElementErrors($form->get('goods_image_name_type'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('商品默认图片'); ?></label>
                                    <div class="col-sm-2">
                                        <img src="<?php echo $this->basePath($form->get('goods_image_default')->getValue()) . '?v='.time(); ?>" style="max-width: 300px;padding-bottom: 5px;">
                                        <?php echo $this->formElement($form->get('goods_image_default')); ?>
                                        <?php echo $this->formElementErrors($form->get('goods_image_default'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>

                                <hr class="col-sm-10">

                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('品牌图片'); ?></label>
                                    <div class="col-sm-2">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('品牌logo宽度'); ?></label>
                                    <div class="col-sm-2">
                                        <div class="input-group">
                                            <?php echo $this->formElement($form->get('brand_logo_width')); ?>
                                            <span class="input-group-addon"><?php echo $this->translate('px'); ?></span>
                                        </div>
                                        <?php echo $this->formElementErrors($form->get('brand_logo_width'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('品牌logo高度'); ?></label>
                                    <div class="col-sm-2">
                                        <div class="input-group">
                                            <?php echo $this->formElement($form->get('brand_logo_height')); ?>
                                            <span class="input-group-addon"><?php echo $this->translate('px'); ?></span>
                                        </div>
                                        <?php echo $this->formElementErrors($form->get('brand_logo_height'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('品牌logo裁切方式'); ?></label>
                                    <div class="col-sm-2">
                                        <?php echo $this->formElement($form->get('brand_logo_crop')); ?>
                                        <?php echo $this->formElementErrors($form->get('brand_logo_crop'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('品牌logo默认图片'); ?></label>
                                    <div class="col-sm-2">
                                        <img src="<?php echo $this->basePath($form->get('brand_logo_default')->getValue()) . '?v='.time(); ?>" style="max-width: 300px;padding-bottom: 5px;">
                                        <?php echo $this->formElement($form->get('brand_logo_default')); ?>
                                        <?php echo $this->formElementErrors($form->get('brand_logo_default'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>

                                <hr class="col-sm-10">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('分类图片'); ?></label>
                                    <div class="col-sm-2">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('分类图片宽度'); ?></label>
                                    <div class="col-sm-2">
                                        <div class="input-group">
                                            <?php echo $this->formElement($form->get('class_image_width')); ?>
                                            <span class="input-group-addon"><?php echo $this->translate('px'); ?></span>
                                        </div>
                                        <?php echo $this->formElementErrors($form->get('class_image_width'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('分类图片高度'); ?></label>
                                    <div class="col-sm-2">
                                        <div class="input-group">
                                            <?php echo $this->formElement($form->get('class_image_height')); ?>
                                            <span class="input-group-addon"><?php echo $this->translate('px'); ?></span>
                                        </div>
                                        <?php echo $this->formElementErrors($form->get('class_image_height'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('分类图片裁切方式'); ?></label>
                                    <div class="col-sm-2">
                                        <?php echo $this->formElement($form->get('class_image_crop')); ?>
                                        <?php echo $this->formElementErrors($form->get('class_image_crop'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('分类默认图片'); ?></label>
                                    <div class="col-sm-2">
                                        <img src="<?php echo $this->basePath($form->get('class_image_default')->getValue()) . '?v='.time(); ?>" style="max-width: 300px;padding-bottom: 5px;">
                                        <?php echo $this->formElement($form->get('class_image_default')); ?>
                                        <?php echo $this->formElementErrors($form->get('class_image_default'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="tab-pane" id="tab_3">
                            <div class="box-body">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('水印设置状态'); ?></label>
                                    <div class="col-sm-2">
                                        <?php echo $this->formElement($form->get('watermark_state')); ?>
                                        <?php echo $this->formElementErrors($form->get('watermark_state'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('水印设置类型'); ?></label>
                                    <div class="col-sm-2">
                                        <?php echo $this->formElement($form->get('watermark_type')); ?>
                                        <?php echo $this->formElementErrors($form->get('watermark_type'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group div-text">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('水印文字'); ?></label>
                                    <div class="col-sm-2">
                                        <?php echo $this->formElement($form->get('watermark_text')); ?>
                                        <?php echo $this->formElementErrors($form->get('watermark_text'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group div-text">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('水印文字大小'); ?></label>
                                    <div class="col-sm-2">
                                        <?php echo $this->formElement($form->get('watermark_text_size')); ?>
                                        <?php echo $this->formElementErrors($form->get('watermark_text_size'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group div-text">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('水印文字颜色'); ?></label>
                                    <div class="col-sm-2">
                                        <?php echo $this->formElement($form->get('watermark_text_color')); ?>
                                        <?php echo $this->formElementErrors($form->get('watermark_text_color'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('水印透明度'); ?></label>
                                    <div class="col-sm-2">
                                        <?php echo $this->formElement($form->get('watermark_trans')); ?>
                                        <?php echo $this->formElementErrors($form->get('watermark_trans'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group div-image">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('水印图片'); ?></label>
                                    <div class="col-sm-2">
                                        <img src="<?php echo $this->basePath($form->get('watermark_image')->getValue()) . '?v='.time(); ?>" style="max-width: 300px;padding-bottom: 5px;">
                                        <?php echo $this->formElement($form->get('watermark_image')); ?>
                                        <?php echo $this->formElementErrors($form->get('watermark_image'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('水印图片位置'); ?></label>
                                    <div class="col-sm-10">
                                        <?php echo $this->formElement($form->get('watermark_location')); ?>
                                        <?php echo $this->formElementErrors($form->get('watermark_location'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="tab-pane" id="tab_4">
                            <div class="box-body">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('图片存储'); ?></label>
                                    <div class="col-sm-2">
                                        <?php echo $this->formElement($form->get('storage_type')); ?>
                                        <?php echo $this->formElementErrors($form->get('storage_type'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group div-local">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('图片动态宽度(PC)'); ?></label>
                                    <div class="col-sm-2">
                                        <div class="input-group">
                                            <?php echo $this->formElement($form->get('local_pc_image_width')); ?>
                                            <span class="input-group-addon"><?php echo $this->translate('px'); ?></span>
                                        </div>
                                        <?php echo $this->formElementErrors($form->get('local_pc_image_width'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group div-local">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('图片动态宽度(Phone)'); ?></label>
                                    <div class="col-sm-2">
                                        <div class="input-group">
                                            <?php echo $this->formElement($form->get('local_phone_image_width')); ?>
                                            <span class="input-group-addon"><?php echo $this->translate('px'); ?></span>
                                        </div>
                                        <?php echo $this->formElementErrors($form->get('local_phone_image_width'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group div-qiniu">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('空间名称'); ?></label>
                                    <div class="col-sm-3">
                                        <?php echo $this->formElement($form->get('qiniu_space_name')); ?>
                                        <?php echo $this->formElementErrors($form->get('qiniu_space_name'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group div-qiniu">
                                    <label class="col-sm-2 control-label">AccessKey</label>
                                    <div class="col-sm-4">
                                        <?php echo $this->formElement($form->get('qiniu_ak')); ?>
                                        <?php echo $this->formElementErrors($form->get('qiniu_ak'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group div-qiniu">
                                    <label class="col-sm-2 control-label">SecretKey</label>
                                    <div class="col-sm-4">
                                        <?php echo $this->formElement($form->get('qiniu_sk')); ?>
                                        <?php echo $this->formElementErrors($form->get('qiniu_sk'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group div-qiniu">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('域名'); ?></label>
                                    <div class="col-sm-2">
                                        <?php echo $this->formElement($form->get('qiniu_scheme')); ?>
                                        <?php echo $this->formElementErrors($form->get('qiniu_scheme'), ['class'=>'error-message']); ?>
                                    </div>
                                    <div class="col-sm-5 div-qiniu">
                                        <?php echo $this->formElement($form->get('qiniu_domain')); ?>
                                        <?php echo $this->formElementErrors($form->get('qiniu_domain'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group div-qiniu">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('前台图片样式(PC)'); ?></label>
                                    <div class="col-sm-4">
                                        <?php echo $this->formElement($form->get('qiniu_pc_image_style')); ?>
                                        <?php echo $this->formElementErrors($form->get('qiniu_pc_image_style'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group div-qiniu">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('前台图片样式(Phone)'); ?></label>
                                    <div class="col-sm-4">
                                        <?php echo $this->formElement($form->get('qiniu_phone_image_style')); ?>
                                        <?php echo $this->formElementErrors($form->get('qiniu_phone_image_style'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group div-aliyun">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('空间名称'); ?></label>
                                    <div class="col-sm-3">
                                        <?php echo $this->formElement($form->get('aliyun_space_name')); ?>
                                        <?php echo $this->formElementErrors($form->get('aliyun_space_name'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group div-aliyun">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('云节点'); ?></label>
                                    <div class="col-sm-2">
                                        <?php echo $this->formElement($form->get('aliyun_oss_domain')); ?>
                                        <?php echo $this->formElementErrors($form->get('aliyun_oss_domain'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group div-aliyun">
                                    <label class="col-sm-2 control-label">AccessKey</label>
                                    <div class="col-sm-4">
                                        <?php echo $this->formElement($form->get('aliyun_ak')); ?>
                                        <?php echo $this->formElementErrors($form->get('aliyun_ak'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group div-aliyun">
                                    <label class="col-sm-2 control-label">SecretKey</label>
                                    <div class="col-sm-4">
                                        <?php echo $this->formElement($form->get('aliyun_sk')); ?>
                                        <?php echo $this->formElementErrors($form->get('aliyun_sk'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group div-aliyun">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('域名'); ?></label>
                                    <div class="col-sm-2">
                                        <?php echo $this->formElement($form->get('aliyun_scheme')); ?>
                                        <?php echo $this->formElementErrors($form->get('aliyun_scheme'), ['class'=>'error-message']); ?>
                                    </div>
                                    <div class="col-sm-5">
                                        <?php echo $this->formElement($form->get('aliyun_domain')); ?>
                                        <?php echo $this->formElementErrors($form->get('aliyun_domain'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group div-aliyun">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('域名类型'); ?></label>
                                    <div class="col-sm-2">
                                        <?php echo $this->formElement($form->get('aliyun_domain_type')); ?>
                                        <?php echo $this->formElementErrors($form->get('aliyun_domain_type'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group div-aliyun">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('前台图片样式(PC)'); ?></label>
                                    <div class="col-sm-4">
                                        <?php echo $this->formElement($form->get('aliyun_pc_image_style')); ?>
                                        <?php echo $this->formElementErrors($form->get('aliyun_pc_image_style'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group div-aliyun">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('前台图片样式(Phone)'); ?></label>
                                    <div class="col-sm-4">
                                        <?php echo $this->formElement($form->get('aliyun_phone_image_style')); ?>
                                        <?php echo $this->formElementErrors($form->get('aliyun_phone_image_style'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                        </div>

                    </div>

                </div>
            </div>
        </div>

    </section>
    <?php echo $this->form()->closeTag(); ?>
</div>
<script>
    $('#watermark_type').change(function () {
        if(this.value == 'image') {
            $('.div-image').show();
            $('.div-text').hide();
        } else {
            $('.div-image').hide();
            $('.div-text').show();
        }
    });
    <?php if($form->get('watermark_type')->getValue() == 'image') { ?>
    $('.div-image').show();
    $('.div-text').hide();
    <?php } else { ?>
    $('.div-image').hide();
    $('.div-text').show();
    <?php } ?>

    $('#storage_type').change(function () {
        if(this.value == 'Local') {
            $('.div-local').show();
            $('.div-qiniu, .div-aliyun').hide();
        } else if(this.value == 'Qiniu') {
            $('.div-qiniu').show();
            $('.div-local, .div-aliyun').hide();
        } else {
            $('.div-aliyun').show();
            $('.div-local, .div-qiniu').hide();
        }
    });
    <?php if($form->get('storage_type')->getValue() == 'Local') { ?>
    $('.div-local').show();
    $('.div-qiniu, .div-aliyun').hide();
    <?php } elseif($form->get('storage_type')->getValue() == 'Qiniu') { ?>
    $('.div-qiniu').show();
    $('.div-local, .div-aliyun').hide();
    <?php } else { ?>
    $('.div-aliyun').show();
    $('.div-local, .div-qiniu').hide();
    <?php } ?>
</script>
